<div class="layuimini-main" id="DeviceLog-Detail">


    <form class="layui-form layui-form-pane" lay-filter="DeviceLog_Detail_div_filter">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="createTime" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">设备SN</label>
                <div class="layui-input-inline">
                    <input type="text" name="deviceSN" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">IP地址</label>
                <div class="layui-input-inline">
                    <input type="text" name="ipAddr" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">方式</label>
                <div class="layui-input-inline">
                    <input type="text" name="method" autocomplete="off" class="layui-input">
                </div>
            </div>
            <!--<div class="layui-inline">
                <label class="layui-form-label">请求ID</label>
                <div class="layui-input-inline">
                    <input type="text" name="requestID" autocomplete="off" class="layui-input">
                </div>
            </div>-->
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">特征长度</label>
                <div class="layui-input-inline">
                    <input type="text" name="fileSize" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">内容</label>
            <div class="layui-input-block">
                <textarea name="body" class="layui-textarea" style="width:100%; height:420px"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <button type="submit" class="layui-btn layui-btn-primary" id="btnDetailClose"><i class="layui-icon">&#x1006;</i> 关闭</button>
            </div>
        </div>
    </form>

</div>
<script>

    layui.use(['form', 'faceAPI'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;
        var faceAPI = layui.faceAPI;
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;

        if (faceAPI.DeviceLogDetail != null) {
            var report = faceAPI.DeviceLogDetail;
            var b = report.body;
            if (b.length > 10) {
                try {
                    var json = JSON.parse(b);//将json字符串格式化为json对象
                    report.body = JSON.stringify(json, null, "\t");
                } catch (error) {
                    console.log('Json 转换时报错：');
                    console.log(error);
                }
                
            }
            
            form.val("DeviceLog_Detail_div_filter", report);

        }

        $('#btnDetailClose').on('click', function () {
            layer.close(parentIndex);
            return false;
        });

    });

</script>